<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link rel="shortcut icon" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/logo.png"/>
	<title>订单评价</title>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.min.js"></script>
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.min.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/all.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/app.css" rel="stylesheet" />
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/font/iconfont.css" rel="stylesheet" />
</head>
<style>
    .pingfen .score{margin-bottom: 5px;}
	.score{width: 100%;height: 25px;line-height: 25px;}
	.score img{width: 20px;height: 20px;margin-top: 2.5px}
	.pj>div{width: 100%;padding: 5px}
	.pj .overpl1{float: left;padding-right: 10px;line-height: 25px;}
	.pj{padding: 5px 0 !important}
	.mui-content{padding-bottom: 0;}
	.add{height: 60px !important;background-repeat: no-repeat;background-size: 100% auto;background-position: center;background-image: url('/static/wechat/img/add.png')}
	.add input[type=file]{width: 60px;height: 60px;opacity: 0}
</style>
<body>
<div class="mui-content">
	<form id="form">
	{{range .shopcar}}
	<div class="evaluation_grade">
		<div class="db-i porduct">
			<img src="{{.pathname}}">
		</div>
		<div class="pingfen db-i">  
			<div class="overpl1">{{.title}}</div>
			<div class="score">
				<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="1">
				<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="2">
				<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="3">
				<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="4">
				<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="5">
				<input type="hidden" name="score">
			</div> 
			<p>
				产品评分
			</p>
		</div>
	</div>  
	<input type="hidden" name="cid" value="{{.id}}">
	<div class="addevaluation">
		<textarea id="appraise" placeholder="宝贝满足你的期望吗？说说它的优点和美中不足的地方吧" name="content"></textarea>
		<div class="picsubmit">
			<div id="newimg">
				<dd class="add"><input type="file" onchange='sword_uppic(this,"shop")' accept="image/*"><input type="hidden" name="imgs"></dd>
				<dd class="add"><input type="file" onchange='sword_uppic(this,"shop")' accept="image/*"><input type="hidden" name="imgs"></dd>
				<dd class="add"><input type="file" onchange='sword_uppic(this,"shop")' accept="image/*"><input type="hidden" name="imgs"></dd>
				<input type="hidden" name="img">
			</div>
		</div>
	</div>
	{{end}}
	<div class="shopevaluation">
		<h1>
			<span class="mui-icon iconfont fs-16">&#xe6d5;</span> 
			店铺评分
		</h1>
		<div class="pj">
			<div>  
				<div class="overpl1">物流服务</div>
				<div class="score">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="1">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="2">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="3">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="4">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="5">
					<input type="hidden" name="shop_logisticsscore">
				</div>  
				<p>
					<span id="score1"></span>
				</p>
			</div>
			<div>  
				<div class="overpl1">服务态度</div>
				<div class="score">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="1">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="2">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="3">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="4">
					<img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/score.png" class="score_img" data-num="5">
					<input type="hidden" name="shop_score">
				</div>  
				<p>
					<span id="score2"></span>
				</p>
			</div>
		</div>
	</div>
	</form>
	<div class="tx-c tjevaluation">
		<button id="btn" class="btn">提交</button>
	</div>
</div>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/other/app.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/zepto.min.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/sword_uppic.js"></script>
{{template "wechat/public/share.html" .}}
<script>
    mui.init({
        swipeBack:true //启用右滑关闭功能
    });
    //释放 nav 底部导航 a 链接
    mui('.mui-tab-item').each(function () {
        this.addEventListener('tap',function () {
            var url = this.getAttribute('href');
            window.location.href=url;
        })
    });
    mui('body').on('tap','.score_img',function(e){
    	var num=this.getAttribute('data-num')
    	mui(this.parentNode.children).each(function(){
    		var nname=this.nodeName
    		if(nname=='INPUT'){
    			this.value=num
    		}else{
    			var num2=this.getAttribute('data-num')
    			if(num2<=num){
    				this.src='/static/wechat/img/score_choose.png'
    			}else{
    				this.src='/static/wechat/img/score.png'
    			}
    		}
    	})
    })
</script>
<div class="mt-statistics">统计代码</div>
<script>
	function serialize(form){
 var form=document.getElementById(form);
 var arr=[];
	for (var i = 0; i < form.elements.length; i++) {
		    var feled=form.elements[i];
		    switch(feled.type) {
		    case undefined:
		    case 'button':
		    case 'file':
		    case 'reset':
		    case 'submit':
		    break;
		    case 'checkbox':
		    case 'radio':
		    if (!feled.checked) {
		    	break;
		    }
		    default:
		    arr.push(feled.name+"="+feled.value)
		    // if (arr[feled.name]) {
			   //  arr[feled.name]=arr[feled.name]+'='+feled.value;
		    // }else{
			   //  arr[feled.name]=feled.value;
		    // } 
	    }
 	}
 	return arr.join("&")
 }
 document.getElementById('btn').addEventListener('tap',function(){
 	$('.picsubmit').each(function(){
 		var va=''
 		$(this).find('input[name="imgs"]').each(function(){
 			if($(this).val()!=""){
 				va+=","+$(this).val()
 			}
 		})
 		$(this).find('input[name="img"]').val(va)
 	})
 	var status=1
 	mui(document.getElementsByName('score')).each(function(){
 		console.log(this.value)
 		if(!this.value){
 			mui.toast('请给产品打分~')
 			status=0
 			return false;
 		}
 	})
 	if (status==0){
 		return false
 	}
 	if(!document.getElementsByName('shop_logisticsscore')[0].value){
 		mui.toast('请给店铺打分~')
 		return false;
 	}
 	if(!document.getElementsByName('shop_score')[0].value){
 		mui.toast('请给店铺打分~')
 		return false;
 	}
 	var that=this
 	that.disabled=true
 	var form=serialize('form')
 	mui.ajax(window.location.href,{
 		data:form,
 		type:'post',
 		timeout:10000,
 		success:function(res){
 			if(res){
 			mui.alert("评价成功",function(){
 				window.location.href=document.referrer
	 			})
	 		}else{
	 			mui.toast('网络繁忙,请稍后再试~')
	 		}
	 		that.disabled=false
 		},error:function(){
 			mui.toast('网络繁忙,请稍后再试~')
 			that.disabled=false
 		}
 	})
 })
</script>
</body>
</html>
